import { createStore } from "vuex";

const store = createStore({
  state: {
    count: 0,
    message: "",
  },
  mutations: {
    increment(state) {
      state.count++;
    },
    setMessage(state, message) {
      state.message = message;
    },
  },
  actions: {
    updateMessage({ commit }, message) {
      commit("setMessage", message);
    },
  },
  getters: {
    getCount: (state) => state.count,
    getMessage: (state) => state.message,
  },
});

export default store;
